
interface CacheData {
    key: string,
    data: {}
}

class CacheTool {

    static getCache(key: string): any {

        let data = localStorage.getItem(key) ;

        return JSON.parse(data ? data: '[]' );
    }

    static cacheChat (obj:CacheData) :void {
        if (typeof (Storage) !== "undefined") {
            localStorage.setItem(obj.key, JSON.stringify(obj.data));
        }
    }
}

export default CacheTool;